package view.other
{
	/**
	 *压路机用来摧毁武器装备
	 *@author CrazyChen 
	 *2013-4-3
	 */	
	import com.greensock.TweenLite;
	import com.greensock.easing.Circ;
	
	import flash.display.Sprite;
	
	import manager.ObjectPool;
	
	public class YaLuJiView extends Sprite
	{
		private var callback:Function;

		public function YaLuJiView()
		{
			super();
			var clip:YaLuJi = new YaLuJi();
			this.addChild(clip);
		}
	
		public function show(_x:int,_y:int,complete:Function):void{
			this.x = _x;
			this.y = _y;
			callback = complete;
			TweenLite.to(this, 1, {x:this.x + 20, y:this.y, ease:Circ.easeInOut ,onComplete:back});
		}
		
		private function back():void{
			TweenLite.to(this, 1, {x:this.x - 40, y:this.y, ease:Circ.easeInOut ,onComplete:tweenCoplete});
		}
		
		private function tweenCoplete():void{
			TweenLite.to(this, 1, {x:this.x + 40, y:this.y, ease:Circ.easeInOut ,onComplete:hide});
		}
		
		private function hide():void{
			if(this.parent){
				this.parent.removeChild(this);
				ObjectPool.putObj(this);
				callback();
			}
		}

	}
}